/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef THIRD_PARTY_TENSORFLOW_LITE_SUPPORT_SCANN_ONDEVICE_CC_UTILS_H_
#define THIRD_PARTY_TENSORFLOW_LITE_SUPPORT_SCANN_ONDEVICE_CC_UTILS_H_

#include <string>

#include "absl/strings/str_format.h"  // from @com_google_absl

namespace tflite {
namespace scann_ondevice {

// Key for the header proto config
inline constexpr char kIndexConfigKey[] = "INDEX_CONFIG";

// Key for the custom user string
inline constexpr char kUserInfoKey[] = "USER_INFO";

// Returns the partition key for a given partition index
inline std::string GetPartitionKey(uint32_t partition_index) {
  return absl::StrFormat("E_%lu", partition_index);
}

// Returns the metadata for the given global offset of the data point.
inline std::string GetMetadataKey(uint32_t datapoint_index) {
  return absl::StrFormat("M_%lu", datapoint_index);
}

}  // namespace scann_ondevice
}  // namespace tflite

#endif  // THIRD_PARTY_TENSORFLOW_LITE_SUPPORT_SCANN_ONDEVICE_CC_UTILS_H_
